import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: '延伸组件',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        splashColor: Colors.transparent,
      ),
      home: Scaffold(
        appBar: AppBar(
          title: Text('延伸组件'),
        ),
        body: HomePage(),
      ),
    );
  }
}

// Row中三个元素，其中第一个元素高度不固定，要求剩余两个元素要跟随第一个元素伸缩
// IntrinsicHeight 表示固定高度
class HomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Row(
      children: [
        Expanded(
          child: IntrinsicHeight(
            child: Row(
              children: [
                Container(
                  height: 100,
                  width: 20,
                  color: Colors.red,
                ),
                Container(
                  width: 20,
                  color: Colors.blue,
                ),
                Container(
                  width: 20,
                  color: Colors.green,
                ),
              ],
            ),
          ),
        ),
      ],
    );
  }
}
